package com.ecspace.knowledgegraphapi.domain.dto;

import com.alibaba.fastjson.JSONArray;

import java.util.List;

public class NodeDTO {

    private String id;

    private String name;

    private String label;

    private List<PropDTO> props;

    public NodeDTO() {
    }

    public NodeDTO(String id, String name, String label, String propsStr) {
        this.id = id;
        this.name = name;
        this.label = label;

        JSONArray array = JSONArray.parseArray(propsStr);
        this.props = array.toJavaList(PropDTO.class);
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public List<PropDTO> getProps() {
        return props;
    }

    public void setProps(List<PropDTO> props) {
        this.props = props;
    }

    @Override
    public String toString() {
        return "NodeDTO{" +
                "name='" + name + '\'' +
                ", label='" + label + '\'' +
                ", props=" + props +
                '}';
    }
}
